package com.rebate.web.servlet;

import java.text.ParseException;
import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class BaseServlet {
	protected Log logger = LogFactory.getLog(this.getClass());
	
	/**
	 * 只有整数的数字return true
	 * @param num
	 * @return
	 */
	protected boolean isNumber(String num) {
		return StringUtils.isNotBlank(num) && StringUtils.isNumeric(num);
	}
	
	protected Date parseDate(String date) {
		try {
			return DateUtils.parseDate(date, new String[]{"yyyy-MM-dd"});
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
